import React from "react";
import { Space } from "antd";
import "moment/locale/zh-cn";
import moment from "moment";

moment.locale("zh-cn");

interface DateFormatProps {
  date: any;
}

const DateFormat: React.FC<DateFormatProps> = ({ date }) => {
  if (!date.props) return <Space>{moment(date).fromNow()}</Space>;
  return <Space>{moment(date.props?.children).fromNow()}</Space>;
};

export default DateFormat;
